package com.synjones.wschool.face.web;

import com.alibaba.druid.util.jdbc.ResultSetBase;
import com.synjones.wschool.common.response.ResultBean;
import com.synjones.wschool.face.service.GateInfoUserService;
import com.synjones.wschool.face.service.request.GateInfoUserAddReq;
import com.synjones.wschool.face.service.request.GateInfoUserDelReq;
import com.synjones.wschool.face.service.request.GateInfoUserFaceReq;
import com.synjones.wschool.face.service.request.GateInfoUserListReq;
import com.synjones.wschool.face.service.response.FaceInfoMultiCheckResp;
import com.synjones.wschool.face.service.response.GateInfoUserVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by 24398 on 2018/8/2.
 */
@Controller
@Slf4j
public class GateInfoController {
    @Resource
    private GateInfoUserService gateInfoUserService;


    /***
     * 新加/替换gateInfo 数据
     * @param req
     * @return
     */
    @RequestMapping("/api/v1/gate/newGateInfo")
    @ResponseBody
    public ResultBean newGateInfoUser(@RequestBody GateInfoUserAddReq req){
         this.gateInfoUserService.newGateInfo(req);
        return ResultBean.success(null);
    }

    /***
     *删除gateInfoUser信息  --  废弃
     * @param req
     * @return
     */
    @RequestMapping("/api/v1/gate/delGateInfo")
    @ResponseBody
    public ResultBean delGateInfoUser(@RequestBody GateInfoUserDelReq req) {
        this.gateInfoUserService.delGateInfo(req);
        return ResultBean.success(null);
    }

    /**
     * 拉取成功检测的人脸数据
     * @param req
     * @return
     */
    @RequestMapping("/api/v1/gate/listFaceInfo")
    @ResponseBody
    public ResultBean listFaceInfo(@RequestBody GateInfoUserFaceReq req){
        List<FaceInfoMultiCheckResp> list = this.gateInfoUserService.listCheckedFaceInfo(req);

        return ResultBean.success(list);
    }

    /****
     * 查询学校的闸机信息
     * @param gateInfoUserListReq
     * @return
     */
    @RequestMapping("/api/v1/gate/listGateInfo")
    @ResponseBody
    public ResultBean  listGateInfo(@RequestBody GateInfoUserListReq gateInfoUserListReq){
        List<GateInfoUserVO> resp = this.gateInfoUserService.listGateInfoUser(gateInfoUserListReq);
        return ResultBean.success(resp);
    }











}
